#include <iostream>
#include <bits/stdc++.h>

using namespace std;

void PrintVector(vector<int> &v) {
    for (vector<int>::iterator it = v.begin(); it < v.end(); it++) {
        cout << *it;
        if (it < v.end() - 1) cout << ", ";
    }
    cout << endl;
}

void InsertSort(vector<int> &v) {
    for (int i = 1; i < v.size(); ++i) {
        for (int j = 0; j < i; ++j) {
            if (v[i] < v[j]) {
                int tmp = v[i];

                // 移动，将 [j, i-1] 这些元素，向右移动1位
                for (int k = i - 1; k >= j; k--) {
                    v[k + 1] = v[k];
                }
                v[j] = tmp;
                PrintVector(v);
            }
        }
    }
}

int main() {
    vector<int> v = {9, 8, 7, 6, 5, 4, 3};
    PrintVector(v);
    cout << "===============" << endl;

    InsertSort(v);

    return 0;
}